<!--该画面是：阶段别预实管理明细画面 -->
<template>
  <div>
    <el-table ref="table1" v-loading="loading" :data="stageList" border>
      <el-table-column :label="$t('projectMaintainName')" prop="project_name" sortable align="center" width="220" />
      <el-table-column :label="$t('projectMaintainSalesDate')" prop="sales_date" sortable align="center" width="130" />
      <el-table-column :label="$t('projectMaintainQuoteDays')" prop="quoted_hours" align="right" width="120" />
      <el-table-column :label="$t('budgetHours')" prop="bugdget_hours" align="right" width="120" />
      <el-table-column :label="$t('actualHours')" prop="actual_hours" align="right" width="120" />
      <el-table-column :label="$t('marginHours')" prop="margin_hours" align="right" width="120" />
      <el-table-column :label="$t('projectMaintainNote')" prop="note" min-width="220" show-tooltip-when-overflow />
    </el-table>
  </div>
</template>

<script>
import { getCombineStageApi } from '@/views/project/projectstage/api/projectcombinestage.api';

export default {
  name: 'ProjectCombineStageInfo',
  props: {
    title: {
      type: String,
      default: ''
    },
    projectPlanId: {
      required: true,
      type: Number
    }
  },
  data() {
    return {
      loading: false,
      stageList: [],
      queryparams: {
        projectPlanFK: undefined
      }
    }
  },
  mounted() {
    this.$watch(() => {
      return this.projectPlanId;
    }, async(newValue) => {
      this.queryparams.projectPlanFK = newValue;
      await this.getstageList();
    }, { immediate: true })
  },
  methods: {
    // 获取合并后的阶段别预实（开发、维护）履历数据
    async getstageList() {
      this.loading = true
      var resp = await getCombineStageApi(this.projectPlanId)
      if (resp.success) {
        this.stageList = resp.data
      } else {
        this.stageList = []
      }
      this.loading = false
    }
  }
};
</script>

  <style scoped>
  @import "~@/views/projectbase/projectcss/project.css";
  </style>
